package com.topscomm.pm.script;

import com.topscomm.cbo.pojo.CboApprovalNodeInsEntity;
import com.topscomm.pm.PmScript;
import com.topscomm.pm.pojo.PmBudgetApplyEntity;
import com.topscomm.pm.service.impl.PmBudgetApplyService;
import com.topscomm.pub.util.ConvertUtil;
import com.topscomm.pub.util.SpringUtil;
import com.topscomm.pub.util.StringBufferProxy;
import com.topscomm.tap.ITapService;
import com.topscomm.tap.TapEntity;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @author: shenyouyi
 * @date: 2020/6/3
 * @description:
 */
public class PmBudgetApplyScript extends PmScript {

    /**
     * 回写项目预算字段
     * @param service
     * @param entity
     */
    public void updateBudgetMoneyOfProject(ITapService service, TapEntity entity) {
        // 预算申请审批通过后，查询当前项目所有的预算申请总和，回写到  budgetmoney
        CboApprovalNodeInsEntity nodeIns = (CboApprovalNodeInsEntity) entity;
        String sourceId = ConvertUtil.convertToString(nodeIns.getSourceid());
        PmBudgetApplyService pmBudgetApplyService = (PmBudgetApplyService) SpringUtil.getBean("pmBudgetApplyService");
        pmBudgetApplyService.updateBudgetMoneyOfProjectBase(sourceId, 9);
    }

}
